import Card.Card;

import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
import Card.*;
import Player.*;

public class Main {
    //ui界面
    public static void ui(Player p1,Player p2) {
        p2.display();
        System.out.println("----------------------------------------");
        System.out.println();
        System.out.println("----------------------------------------");
        p1.display();
    }
    //登录界面
    public static int login() {
        Scanner in = new Scanner(System.in);
        System.out.println("============================");
        System.out.println("========  0，退出游戏   ======");
        System.out.println("========  1，开始游戏   ======");
        System.out.println("============================");
        System.out.println("游戏介绍");
        System.out.println("请输入=>");
        int choose = in.nextInt();
        return choose;
    }
    //主函数
    public static void main(String[] args) {
        //准备随机数与输入
        Random random = new Random();
        Scanner in = new Scanner(System.in);
        //接收登录时的选择
        if(login() == 1) {
            //创建两游戏对象
            Player p1 = new Gamer();
            Player p2 = new Computer();
            //显示ui界面
            ui(p1,p2);
            //显示玩家的牌
            System.out.println(p1.toString());
            System.out.println("请输入想要打出的牌");
            int point1 = in.nextInt();
            System.out.println("----------------------------------------");
            int hp = p1.playCard(point1);
            System.out.print("   ");

            if(p1.receiveCard(point1) == "杀") {
                p2.playCard(2);
            }else{
                System.out.print("电脑扣了"+hp+"点生命值");
                p2.Hp -= hp;
            }
            //p2.playCard(random.nextInt(2)+1);
            System.out.println();
            System.out.println("----------------------------------------");
            p2.display();
            p1.display();

        }else if (login() == 0) {
            System.exit(0);
        }else {
            System.out.println("非法输入");
        }
    }
}
